package javagamecontroller.activities.controllers;

import com.javagamecontroller.R;
import javagamecontroller.activities.SelectController;
import javagamecontroller.connection.BluetoothMessenger;
import android.annotation.TargetApi;
import android.app.DialogFragment;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.Vibrator;
import android.view.Window;
import android.view.WindowManager;
import android.widget.GridView;


/**
 * A frame for a controller with two joysticks at the bottom and a grid of buttons above those.
 * @author Ben Schwab
 * 
 */
public class JoystickController extends ControllerFrame {

    public static final String BUTTON_MANAGER = "button_manager";
    private BluetoothMessenger bMessenger;

    @Override
    public void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // be able to specify the number of joysticks
        bMessenger = BluetoothMessenger.getInstance();
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                                  WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.joystick_layout);
        GridView gridview = (GridView) findViewById(R.id.grid_view_joystick);
        Bundle extras = getIntent().getExtras();
        String buttonLayout = extras.getString(BUTTON_MANAGER);
        initializeButtonManager(buttonLayout);
        if (getButtonManager() != null) {
            gridview.setAdapter(getButtonManager());
        }

    }

  

}
